import 'package:flutter/material.dart';

///自定义下拉菜单选择框
class MenuItem {
  ///显示文本
  String label;

  ///选中的值
  dynamic value;

  ///是否选中
  bool checked;

  MenuItem({required this.label, required this.value, this.checked = false});
}

class MyPopupMenuButton extends StatefulWidget {
  ///显示的内容
  final List<MenuItem> items;

  ///选中的值
  final dynamic value;

  ///选中的标题
  final String? title;

  ///提示内容
  final String tooltip;

  const MyPopupMenuButton(
      {required this.items, this.value, this.title, this.tooltip = "点击选择", Key? key})
      : super(key: key);

  @override
  State<MyPopupMenuButton> createState() => _MyPopupMenuButtonState();
}

class _MyPopupMenuButtonState extends State<MyPopupMenuButton> {
  ///是否展开下拉按钮
  bool isExpand = false;
  @override
  void initState() {

    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Wrap(
      children: [

      ],
    );
  }

  ///根据当前的value处理当前文本显示
  // void initTitle(){
  //   if(widget.value != null){
  //     for(MenuItem item in widget.items){
  //       if(item.value == widget.value){
  //         widget.value =
  //       }
  //     }
  //   }
  // }
}
